﻿<%@ Page Title="Aspose.Words for .Net [User Input Invoice to PDF] - Demo" Language="C#"
    MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
    Inherits="ASPNet_User_Input_Invoice_To_PDF._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    <script type="text/javascript" language="javascript">
        function AllowNumericOnly(key) {

            var charCode = (key.which) ? key.which : charCode;
            //alert(charCode);
            if ((charCode >= 48 && charCode <= 57) || (charCode >= 96 && charCode <= 105) || charCode == 8 || charCode == 9 || charCode == 37 || charCode == 39 || charCode == 46)
                return true;

            return false;
        }
        function AllowNumericDecimalsOnly(key) {

            var charCode = (key.which) ? key.which : charCode;
            if ((charCode >= 48 && charCode <= 57) || (charCode >= 96 && charCode <= 105) || charCode == 8 || charCode == 9 || charCode == 110 || charCode == 37 || charCode == 39 || charCode == 46)
                return true;

            return false;
        }
    </script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        Welcome to Aspose.Words for .Net [User Input Invoice to PDF] - Demo
    </h2>
    <p>
        This demo is created to demonstrate the <a href="http://www.aspose.com/.net/word-component.aspx"
            title="ASP.NET Website" target="_blank">Aspose.Words for .Net</a>.
    </p>
    <hr />
    <h4>
        <asp:Label ID="lblMessage" runat="server" Font-Bold="true" Text="" ForeColor="Maroon"></asp:Label></h4>
    <table width="100%">
        <tr>
            <td colspan="2">
                <h2>
                    Invoice Detail</h2>
            </td>
        </tr>
        <tr>
            <td>
                <table width="100%">
                    <tr>
                        <td colspan="2">
                            <h3>
                                Billing From (Company Detail)</h3>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Company Logo
                        </td>
                        <td>
                            <asp:FileUpload ID="fuCompanyLogo" runat="server" Width="220px" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Company Name
                        </td>
                        <td>
                            <asp:TextBox ID="txtCompanyName" runat="server" placeholder="Company Name" Width="220px"
                                MaxLength="50"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Company Address
                        </td>
                        <td>
                            <asp:TextBox ID="txtCompanyAddress" runat="server" placeholder="Company Address"
                                Width="220px" MaxLength="50"></asp:TextBox>&nbsp;<asp:RequiredFieldValidator CssClass="errors"
                                    ID="rfvCompanyAddress" runat="server" ControlToValidate="txtCompanyAddress" ErrorMessage="*Required"
                                    ValidationGroup="vgInvoice" Display="Dynamic"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            <asp:TextBox ID="txtCompanyStateZip" runat="server" placeholder="State, Zip code"
                                Width="220px" MaxLength="50"></asp:TextBox>&nbsp;<asp:RequiredFieldValidator CssClass="errors"
                                    ID="rfvCompanyStateZip" runat="server" ControlToValidate="txtCompanyStateZip"
                                    ErrorMessage="*Required" ValidationGroup="vgInvoice" Display="Dynamic"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            <asp:TextBox ID="txtCompanyCountry" runat="server" placeholder="Country" Width="220px"
                                MaxLength="50"></asp:TextBox>&nbsp;<asp:RequiredFieldValidator CssClass="errors"
                                    ID="rfvCompanyCountry" runat="server" ControlToValidate="txtCompanyCountry" ErrorMessage="*Required"
                                    ValidationGroup="vgInvoice" Display="Dynamic"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                </table>
            </td>
            <td align="right">
                <table width="100%" align="right">
                    <tr>
                        <td colspan="2">
                            <h3>
                                Billing To (Customer Detail)</h3>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Customer Name
                        </td>
                        <td>
                            <asp:TextBox ID="txtCustomerName" runat="server" placeholder="Customer Name" Width="220px"
                                MaxLength="50"></asp:TextBox>&nbsp;<asp:RequiredFieldValidator CssClass="errors"
                                    ID="rfvCustomerName" runat="server" ControlToValidate="txtCustomerName" ErrorMessage="*Required"
                                    ValidationGroup="vgInvoice" Display="Dynamic"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Customer Address
                        </td>
                        <td>
                            <asp:TextBox ID="txtCustomerAddress" runat="server" placeholder="Customer Address"
                                Width="220px" MaxLength="50"></asp:TextBox>&nbsp;<asp:RequiredFieldValidator CssClass="errors"
                                    ID="rfvCustomerAddress" runat="server" ControlToValidate="txtCustomerAddress"
                                    ErrorMessage="*Required" ValidationGroup="vgInvoice" Display="Dynamic"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            <asp:TextBox ID="txtCustomerStateZip" runat="server" placeholder="State, Zip code"
                                Width="220px" MaxLength="50"></asp:TextBox>&nbsp;<asp:RequiredFieldValidator CssClass="errors"
                                    ID="rfvCustomerStateZip" runat="server" ControlToValidate="txtCustomerStateZip"
                                    ErrorMessage="*Required" ValidationGroup="vgInvoice" Display="Dynamic"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            <asp:TextBox ID="txtCustomerCountry" runat="server" placeholder="Country" Width="220px"
                                MaxLength="50"></asp:TextBox>&nbsp;<asp:RequiredFieldValidator CssClass="errors"
                                    ID="rfvCustomerCountry" runat="server" ControlToValidate="txtCustomerCountry"
                                    ErrorMessage="*Required" ValidationGroup="vgInvoice" Display="Dynamic"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <h2>
                    Invoice Products</h2>
            </td>
            <td align="right">
                <asp:Button ID="btnAddProducts" runat="server" Text="Reset Rows" OnClick="btnAddProducts_Click" />
                &nbsp;<asp:TextBox ID="txtAddProductRows" runat="server" Width="25px" MaxLength="2"
                    Text="1" onkeydown=" return AllowNumericOnly(event);"></asp:TextBox>&nbsp;<asp:RequiredFieldValidator
                        CssClass="errors" ID="rfvAddProductRows" runat="server" ControlToValidate="txtAddProductRows"
                        ErrorMessage="*Required" ValidationGroup="vgInvoice" Display="Dynamic"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:GridView ID="grdInvoiceProducts" TabIndex="14" Width="100%" runat="server" AllowPaging="false"
                    AutoGenerateColumns="False" GridLines="Horizontal" DataKeyNames="ProductId" EmptyDataText="There is no record found."
                    ShowHeaderWhenEmpty="True" PageSize="99" BackColor="White" BorderColor="#999999"
                    BorderStyle="Solid" BorderWidth="1px" CellPadding="3" ForeColor="Black" ShowFooter="false"
                    OnRowDataBound="grdInvoiceProducts_RowDataBound">
                    <HeaderStyle CssClass="alt" BackColor="#CCCCCC" Font-Bold="True"></HeaderStyle>
                    <RowStyle CssClass="alt" BackColor="#CCCCCC"></RowStyle>
                    <AlternatingRowStyle CssClass="alt" BackColor="#CCCCCC"></AlternatingRowStyle>
                    <Columns>
                        <asp:TemplateField HeaderText="No" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign="Middle"
                            HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" HeaderStyle-Width="30px">
                            <ItemTemplate>
                                <asp:Label ID="lblNo" Text='<%# Convert.ToInt64(DataBinder.Eval(Container, "RowIndex")) + 1 %>'
                                    runat="server"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Description" ItemStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Middle"
                            HeaderStyle-HorizontalAlign="Left" HeaderStyle-VerticalAlign="Middle">
                            <ItemTemplate>
                                <asp:TextBox ID="txtProductDescription" runat="server" Text="" Width="97%"></asp:TextBox>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Price" ItemStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Middle"
                            HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" HeaderStyle-Width="115px">
                            <ItemTemplate>
                                <asp:TextBox ID="txtProductPrice" runat="server" Text="0.00" Width="97%" onkeydown=" return AllowNumericDecimalsOnly(event);"></asp:TextBox>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Quantity" ItemStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Middle"
                            HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" HeaderStyle-Width="60px">
                            <ItemTemplate>
                                <asp:TextBox ID="txtProductQuantity" runat="server" Text="1" Width="97%" onkeydown=" return AllowNumericOnly(event);"></asp:TextBox>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="VAT" ItemStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Middle"
                            HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" HeaderStyle-Width="85px">
                            <ItemTemplate>
                                <asp:DropDownList ID="ddlProductVAT" runat="server">
                                </asp:DropDownList>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td colspan="2" align="right">
                <asp:Button ID="btnClearForm" runat="server" Text="Clear Fields" OnClick="btnClearForm_Click" />&nbsp;
                <asp:Button ID="btnGeneratePDF" runat="server" Text="Generate Invoice in PDF" OnClick="btnGeneratePDF_Click"
                    ValidationGroup="vgInvoice" />
            </td>
        </tr>
    </table>
    <hr />
</asp:Content>
